package logic

import (
	"context"

	"HD_running/mall/order/api/internal/svc"
	"HD_running/mall/order/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type FindresuleproLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewFindresuleproLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FindresuleproLogic {
	return &FindresuleproLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *FindresuleproLogic) Findresulepro(req *types.FindresultReq) (resp *types.ResultfindResp, err error) {
	list, err := l.svcCtx.ResultproModel.FindSno(l.ctx, req.Sno)
	if err != nil {
		return nil, err
	}

	var res []types.Resultfind
	for _, item := range list {
		var temp types.Resultfind
		temp.Sno = item.Sno
		temp.Date1 = item.Date1
		temp.Resqu = item.Resqu
		res = append(res, temp)
	}
	return &types.ResultfindResp{Resultfindlist: res}, nil
}
